
#include "Item.h"
#include "ItemManager.h"

Item::Item()
:	mData( F_NULL ) , mNum( 0 )
{

}


Item::~Item()
{
	
}


fbool			Item::Init( fint32 id , fint32 num )
{
	mData = gItemManager->GetItemData( id );
	mNum = num;

	if ( mData )
	{
		return F_TRUE;
	}
	else
	{
		mNum = 0;
		return F_FALSE;
	}
}


fvoid			Item::Release()
{
	mData = F_NULL;
	mNum = 0;
}


ItemData*		Item::GetData()
{
	return mData;
}


fint32			Item::GetID()
{
	if ( mData )
	{
		return mData->ID;
	}

	return INVALID_ID;
}


fint32			Item::GetNum()
{
	return mNum;
}


fvoid			Item::Use()
{
	mNum--;

	if ( !mNum )
	{
		Release();
	}

}

fvoid			Item::Add( fint32 num )
{
	mNum += num;
}

